package o;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.concurrent.atomic.AtomicInteger;

public abstract class bmf extends SQLiteOpenHelper {
    private final AtomicInteger ˎ = new AtomicInteger();

    protected abstract void ˊ(SQLiteDatabase sQLiteDatabase, int i);

    public bmf(Context context, String str, CursorFactory cursorFactory, int i) {
        super(context, str, cursorFactory, i);
    }

    public void onCreate(SQLiteDatabase sQLiteDatabase) {
        ˊ(sQLiteDatabase, -1);
    }

    public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
        ˊ(sQLiteDatabase, i2);
    }

    public void onDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
        ˊ(sQLiteDatabase, i2);
    }

    public boolean ʼ(String str) {
        if (str == null || str.length() <= 0 || str.length() > 30) {
            return false;
        }
        return true;
    }

    public void ˎ() {
        this.ˎ.incrementAndGet();
    }

    public void ॱ() {
        if (this.ˎ.decrementAndGet() <= 0) {
            super.close();
        }
    }

    public synchronized void close() {
        ॱ();
    }
}
